package com.santu.edu.supporter.biz.order.helpbuy.pojo.enums;

import com.santu.edu.supporter.exception.BizException;
import com.santu.edu.supporter.exception.CustomError;

/**
 * @author luoyaoqi
 * @createTime 2024/2/21
 * @description
 */
public enum HelpByProcessType {

    /**
     *
     */
    PRODUCT_NOT_PURCHASED(0,"商品未购买"),
    PRODUCT_PURCHASED(1,"商品已购买"),
    CUSTOMER_HAS_MADE_PAYMENT(2,"客户已付款"),;

    private Integer code;

    private String desc;


    HelpByProcessType(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public static HelpByProcessType convert(Integer code) {
        for (HelpByProcessType helpByProcessType : HelpByProcessType.values()) {
            if (helpByProcessType.getCode().equals(code)) {
                return helpByProcessType;
            }
        }
        throw BizException.causeBy(CustomError.ENUM_CONVERT_ERROR,"HelpByProcessType转换异常");
    }
}
